<?php
/**
 * Created by PhpStorm.
 * User: yuyi
 * Date: 2017/9/9
 * Time: 17:03
 */

namespace app\common\model;

use \think\Db;
class Student extends \think\Model
{
    //学生注册
    public function register($data){
        $res=DB::name('student')->insert($data);
    }

    /*
     * 信息更新
     * $data=保存的数据
    */

    public function edit($data){
        $validate = \think\Loader::validate('Student');

        if(!$validate->check($data))
            return $validate->getError();

        if($user_data=$this->save($data,['username'=>$data["username"]]))
            return $user_data;
        else
            return $this->getError();
    }
}